﻿
using OpenCvSharp;

using Xc.DataAccess.CodeReader.Properties;
using Xc.DataAccess.Core;

namespace Xc.DataAccess.CodeReader.Models.Filters
{
    /// <summary>
    /// 绘制圆圈
    /// </summary>
    [Filter("绘制圆圈",FilterType.Draw)]
    public class DrawCircle:FilterBase
    {
        /// <summary>
        /// 原点
        /// </summary>
        [InputParameter("原点")]
        public CVPoint Center { get; set; }=new CVPoint();
        /// <summary>
        /// 半径
        /// </summary>
        [InputParameter("半径")]
        public int Radius { get; set; }
        /// <summary>
        /// 颜色
        /// </summary>
        [InputParameter("颜色")] 
        public Scalar Color { get; set; }
        /// <summary>
        /// 粗细
        /// </summary>
        [InputParameter("粗细", ParameterType.Optional)]
        public int Thickness { get; set; } = 1;
        /// <summary>
        /// 线段类型
        /// </summary>
        [InputParameter("线段类型", ParameterType.Optional)]
        public LineTypes LineType { get; set; } = LineTypes.Link8;
        /// <summary>
        /// 偏移量
        /// </summary>
        [InputParameter("缩放值", ParameterType.Optional)]
        public int Shift { get; set; } = 0;
        internal override ResultData<Mat> UseChannel(Mat mat, FilterBase[] filterInfos, FilterBase preFilterBase)
        {
            Cv2.Circle(mat, Center,Radius,Color, Thickness,LineType, Shift);
            return ResultData<Mat>.Accept(TextResource.draw_success,mat);
        }
    }
}
